use std::collections::HashMap;

struct Solution {}

fn main() {}

impl Solution {
    pub fn make_equal(words: Vec<String>) -> bool {
        let mut cnt_map: HashMap<char, i32> = HashMap::new();
        for x in words.iter() {
            for c in x.chars() {
                if !cnt_map.contains_key(&c) {
                    cnt_map.insert(c.clone(), 1);
                    continue;
                }
                cnt_map.insert(c.clone(), cnt_map.get(&c).unwrap() + 1);
            }
        }

        let div = words.len() as i32;
        for x in cnt_map {
            if x.1 % div != 0 {
                return false;
            }
        }
        true
    }
}